Biodiversity stabilizes plant communities through statistical-averaging effects rather than compensatory dynamics

Understanding the relationship between biodiversity and ecosystem stability is a central goal of ecologists. Recent studies have concluded that biodiversity increases community temporal stability by increasing the asynchrony between the dynamics of different species. Theoretically, this enhancement can occur through either increased between-species compensatory dynamics, a fundamentally biological mechanism; or through an averaging effect, primarily a statistical mechanism. Yet it remains unclear which mechanism is dominant in explaining the diversity-stability relationship. We address this issue by mathematically decomposing asynchrony into components separately quantifying the compensatory and statistical-averaging effects. We applied the new decomposition approach to plant survey and experimental data from North American grasslands. We show that statistical averaging, rather than compensatory dynamics, was the principal mediator of biodiversity effects on community stability. Our simple decomposition approach helps integrate concepts of stability, asynchrony, statistical averaging, and compensatory dynamics, and suggests that statistical averaging, rather than compensatory dynamics, is the primary means by which biodiversity confers ecological stability.

by increases in other species, thereby stabilizing aggregate community biomass 18 . Such negative covariances typically arise either from differential responses of diverse species to environmental variations, or from competition among species 12,18 . In the literature, a classic approach to detect compensatory dynamics is the variance ratio (usually denoted as φ), which compares the variance of the aggregate community to the expected variance under the assumption of independent population fluctuations 22,23 . Some authors have interpreted φ > 1 to indicate dynamics which are, on balance, synchronous among populations, whereas φ < 1 has been interpreted to indicate compensatory dynamics. In contrast, "statistical averaging" or the "portfolio effect" refers to the fact that a community consisting of many independently fluctuating (zero correlation) species tends to be more stable than a community consisting of few such species 20 , primarily a statistical mechanism. Though some have used the terminology "portfolio effects" in alternative ways that differ slightly with respect to whether joint responses of species to the environment are included 11,12,19,21 , we here use the term as specified above, revisiting this issue below and in the Supporting Information and showing that our conclusions are qualitatively the same for alternative definitions (see Results, Discussion, and Methods section).
The measure of asynchrony, Φ, conflates the effects of compensatory dynamics (henceforth called the "compensatory effect" and denoted as CPE) and the effects of statistical averaging (henceforth denoted SAE); these effects have not typically been explicitly separated. Several recent studies have reported that the positive diversity-stability relationship was largely determined by species asynchrony 7,[15][16][17][24][25][26][27] , i.e., a positive association between diversity and Φ. However, it remains unclear whether this pattern is primarily a statistical phenomenon (SAE) or due to a biological mechanism (CPE). Moreover, recent studies focused on how community stability was altered by external drivers, e.g., grazing 15 , eutrophication 24,25 , and drought 26 . It is claimed that these drivers altered community stability by changing species asynchrony. Again, it remains unknown whether statistical averaging or compensatory dynamics were altered. This is particularly important for uncovering how community stability is maintained or reduced, to help inform ecosystem conservation and restoration efforts. It is also a key scientific question considering the long-standing controversy of the relationship between biodiversity and stability and the underlying mechanisms 3,9,12,19 . Here, we ask whether biodiversity promotes asynchrony, and therefore community stability, principally by promoting CPE or SAE (Fig. 1b). Especially because compensatory dynamics depends on aspects of the biology of interacting species, whereas statistical averaging is primarily a statistical effect, answering this question is essential for a deeper understanding of the mechanisms underlying the diversity-stability relationship. According to our results, the positive relationship between SAE and diversity primarily accounts for the stabilizing effects of biodiversity on community stability.

Theoretical framework
The equation S com = ΦS pop has been used as follows in much past research 15,24,28 to understand whether diversity promotes community stability principally by promoting population stability or asynchrony: (1) S com , Φ, S pop and diversity are computed in several experimental or observed ecosystems; (2) S com , Φ, and S pop are plotted against diversity; and (3) regression slopes for Φ and S pop are compared to judge the relative importance of the pathways of Fig. 1a. We developed an extension of this framework to determine whether compensatory or statistical averaging effects are the principal mediator of diversity effects on asynchrony and thence on community stability. The extended framework is S com = (CPE)(SAE)S pop , where Φ = (CPE)(SAE). The formal definitions of CPE and SAE are in Methods, where the new equations above are also derived. By expressing asynchrony as the product of compensatory and statistical averaging effects, these equations clarify an intrinsic link between three mechanisms which previously have largely been studied separately. We assessed the contribution of the pathways in Fig. 1b using plots of CPE, SAE, and S pop , computed in collections of experimental or observed ecosystems, against diversity.
Lastly, we proposed a framework to further decompose CPE into effects due to differential responses to environmental perturbations (CPE env ) and effects due to species interactions (CPE int ). This secondary decomposition allows our theory to encompass the alternative definition of portfolio effects mentioned in the Introduction (see also Discussion), and makes it possible to show that our main conclusions are robust to the definition used. The alternative definition turns out to equal SAE × CPE env (Methods section).

Empirical analyses
Our approach was applied to two empirical datasets (Table 1): a plant survey dataset containing nine sites at which long-term survey were carried out on natural grasslands 10 ; and a biodiversitymanipulated experimental dataset containing two long-term experiments (BigBio and BioCON) for which plant species numbers were manipulated.
In the plant survey dataset, the statistical averaging effect, SAE, was the principal mediator of the diversity-stability relationship, not the compensatory effect, CPE. Community stability was strongly positively associated with species richness (Fig. 2a), due principally to a strong positive association between SAE and richness ( Fig. 2e) leading to a strong positive relationship between asynchrony and richness (Fig. 2c). Neither CPE (Fig. 2d) nor population stability (Fig. 2b) was significantly related to richness. Though both SAE and CPE were significantly associated with community stability (Fig. 3), the differences in association of these variables with diversity ( Fig. 2) means that the effects of diversity on community stability was mediated by SAE, not CPE. Similar patterns held when other biodiversity indices were used in place of richness, e.g., Shannon's index ( Supplementary Fig. 1), and the inverse of Simpson's index ( Supplementary Fig. 2). Empirical studies show that biodiversity may increase or decrease population stability, but it generally promotes asynchrony (a; adapted from Xu et al. 7 ). Asynchrony can be further decomposed multiplicatively into an effect of compensatory dynamics (CPE) and a statistical-averaging effect (SAE; b). We assessed how biodiversity separately alters CPE and SAE.
In the biodiversity-manipulated experimental dataset, SAE was again the crucial mechanism behind positive diversity-stability relationships, when such relationships occurred. For both BigBio and BioCON, SAE showed strong positive relationships with species richness ( Fig. 4e). However, relationships between CPE and richness were either negative or only slightly positive (Fig. 4d), so that the combined positive effect of diversity on asynchrony (Fig. 4c) was driven primarily by the SAE effect. Negative effects of richness on population stability ( Fig. 4b) then further counteracted the SAE mechanism, yielding overall relationships between diversity and community stability which were positive primarily because of the SAE mechanism (BigBio); or which were slightly negative, and would have been much more negative were it not for the SAE mechanism (BioCON) (Fig. 4a). Though community stability was positively related with all three of its constituents (SAE, CPE, and population stability; Fig. 5), the negative or only slightly positive relationships of CPE and population stability with diversity meant that only SAE contributed substantially to positive diversity-stability relationships, when the latter occurred. Similar patterns were found using other biodiversity indices (Shannon index, Supplementary Fig. 3; inverse Simpson's index, Supplementary Fig. 4).
We applied our secondary decomposition approach (i.e., further decomposing CPE into CPE env and CPE int ; see Methods and Supplementary Fig. 5) to the two empirical datasets. In the plant survey dataset, CPE env and CPE int were only modestly positively associated with diversity ( Supplementary Fig. 6a, b). Similarly, in the biodiversitymanipulated experimental dataset, CPE env and CPE int were either negatively associated with richness or were modestly positively associated with it ( Supplementary Fig. 7a, b). As a result, the SAE dependence on diversity was stronger and was still the primary mechanism of positive diversity-stability relationships in these systems. For both datasets, the dependence of SAE × CPE env (corresponding to the alternative definition of portfolio effects; Supplementary Figs. 6c, d and 7c, d) on diversity was substantially stronger than the dependence of CPE int on diversity ( Supplementary Figs. 6b and 7b).

Discussion
Recently, many studies have attributed the stabilizing effect of biodiversity to its enhancement of between-species asynchrony 7,15-17,24-27 . Asynchrony is a different concept from compensatory dynamics, though these terms are sometimes used interchangeably 7 . We developed a framework for illustrating that asynchrony can arise from both compensatory dynamics and statistical-averaging effects, and for isolating the contributions of these effects. Our analyses of grassland communities show that the statistical-averaging effect matters much more than compensatory dynamics for explaining commonly observed positive relationships between biodiversity and asynchrony and community stability. Our results should not be interpreted to mean that compensatory dynamics are not important for community stabilitythey are (Figs. 3c and 5c, and Supplementary Table 1). But compensatory effects apparently do not necessarily play a substantial role in producing positive relationships between diversity and stability, at least in our grassland systems, because a more diverse grassland community does not show dynamics which are compensatory to a substantially greater extent than a less diverse community. Though grassland systems have been the most common and important model systems so far for investigating relationships between diversity and stability, whether other ecosystem types (e.g., forest 16 , meadow 27 , and plankton 29 systems) show results similar to ours remains an important unanswered question.
One possible reason that statistical averaging played a strong role in mediating diversity-stability relationships is the relatively small spatial scale of our study plots. In such small plots, species dynamics are significantly influenced by demographic stochasticity, due to their low abundance, which leads to independent fluctuations among species. Indeed, de Mazancourt et al. 30 illustrated that demographic stochasticity, rather than environmental stochasticity, was the major process explaining diversity-stability relationships across four longterm biodiversity experiments, including the two experiments in our study. Therefore, our results were consistent with de Mazancourt et al. 30 At larger scales, it is possible that CPE plays a more important role in mediating diversity-stability relationships, as the effect of demographic stochasticity should decrease while that of environmental stochasticity should increase. Testing this hypothesis would require large-scale community data that are surveyed over time and with replicates.
Our analyses show that compensatory dynamics are an important contributor to community stability, but not necessarily an important mediator of diversity-stability relationships. Compensatory dynamics can arise from differential responses of species to environmental fluctuations 30,31 and/or species interactions 32,33 . In areas with stronger environmental fluctuations, we may find stronger CPE and possibly a larger contribution of CPE to diversity-stability relationships. Hallett et al. 10 showed, using the plant survey dataset we have also used here, that precipitation variability enhanced compensatory dynamics in grassland communities. It is also possible, a priori, that strong environmental fluctuations could reduce CPE and promote synchronous dynamics if species-specific responses to the environment were positively correlated 31 . In this later case, if a higher species richness were to contribute to weakening the synchronizing effects of environmental fluctuations, CPE could then provide an important mediator for diversity-stability relationships. Our study detected considerable compensatory dynamics, due to both environmental fluctuations and species interactions (Supplementary Figs. 6-7). But compensatory dynamics were not related to diversity in our study systems, so CPE played no major role in mediating diversity-stability relationships. The terms "insurance effect", "statistical averaging effect", and "portfolio effect" are widely used in explaining the stabilizing effects of biodiversity 11,12,[18][19][20][21] . All these terms relate to the fact that aggregate ecosystem properties vary less in more diverse communities. Though these terms have, at times, been used interchangeably, their meanings differ, and our theory separates them explicitly. The insurance effect emphasizes differential responses of diverse species to environmental variations or species competitive interactions, fundamentally biological mechanisms 12,30 . In contrast, the "statistical averaging effect" was initially used to describe the stabilizing effect of independent fluctuations, a fundamentally statistical phenomenon also exhibited in stock portfolios and diverse other non-biological contexts; it corresponds to our SAE 20 . An alternative definition of "portfolio effect" (i.e., SAE × CPE env in our secondary decomposition) allows for non-zero correlations among species, and accounts for both statistical effects and joint responses of distinct species to environmental perturbations 12,19,21 (Methods and Supplementary Fig. 5). Our theory provides a flexible framework to quantitatively distinguish these different terms. Our conclusion held, that statistical averaging effects were the principal mechanism behind positive diversity-stability relationships in our data, regardless of the definitions used (Figs. 2 Table 1 for full names). All values are log 10 transformed. Error bars: standard error (log 10 transformed) across plots within each site. The ordinary linear regression model was used to test significance. Black lines: regressions through averages, dashed = non-significant at the 0.05 level. Shaded area: 95% confidence bands. *p < 0.05, **p < 0.01, ***p < 0.001. Note that slopes on d and e add to the slope on c, and the slopes on c and b add to that on a, except for rounding error.
the importance of evenness of abundance 9,28,30,34 ; our theory helps illuminate the role of another kind of evenness in stability. It has been reported that unevenness can alter the way in which population variability and portfolio effects change with species richness 9 . Species evenness can also enhance the positive relationship between complementarity effects and species asynchrony 28 . Distinct from evenness of average abundances among species considered in previous studies, our theory involves evenness of temporal variability among species (see Eq. (4) in Methods), which substantially influences SAE, together with species richness. Based on our theory, for a given species richness, a higher evenness of variability will lead to a higher SAE, thus increasing community stability. This highlights the importance of the evenness of variability for further consideration in future studies. Our theoretical framework may be useful for a wide variety of studies which examine the influence of external factors on the relationship between diversity and stability. Our framework involves population stability, asynchrony, compensatory dynamics, and statistical-averaging, helping unify these ideas. Our measure of compensatory effects is actually a transformation of the classic variance ratio 22,23 (see Methods section for details), which has been commonly used. Studies reporting altered diversity-stability relationships under altered externally imposed conditions can use our theory to ascertain details of the mechanisms by which their observed effects operate. For example, Hautier et al. 24,25 found that fertilization weakened the positive association between diversity and stability in grasslands, due to a reduction in strength of the positive richness-asynchrony relationship. Our theory, applied to their data, should make it possible to determine if fertilization weakens the relationship between statistical averaging and diversity, possibly by altering evenness; or if it weakens the relationship between compensatory dynamics and diversity, possibly by promoting population growth of different species simultaneously. Further partitioning of effects is also possible using our secondary decomposition of CPE.
We note that while we have decomposed the stabilizing effects of biodiversity into multiple terms representing different processes, this does not mean that these terms are necessarily independent of each other. Instead, they may often be related, as all of them are driven by shared ecological processes in realistic communities. For instance, interspecific competition affects the patterns of species diversity (both the number and evenness of species), compensatory dynamics across species, and population variability 35,36 . To this end, our decomposition framework provide approaches to tease apart different pathways by which a single cause generates an effect. Moreover, our framework integrates multiple concepts that have been commonly used in the literature but often interpreted in different ways, helping clarify how these ideas are linked, quantitatively.
The diversity-stability relationship has long been a central question in ecology, and its underlying mechanisms are still much debated 7,12 . Our results have revealed that statistical mechanisms, rather than biological ones, appear to be of predominant importance for the relationship between biodiversity and ecological stability, at least for the data we examined. We are not suggesting that ecologists should ignore factors related to compensatory dynamics (e.g., niche differences) in attempting to understand community stability, because these factors indeed represent a key component of community stability and may contribute to diversity-stability relationships in broader contexts, e.g., at larger spatial scales. Instead, we have observed that, for the systems we examined, diversity was not strongly or consistently related to compensatory mechanisms in the same way that it was strongly and consistently associated with statistical averaging effects. Our theory provides a flexible framework for future research to quantify different mechanisms and understand their possible context dependency.

Empirical data
We applied our theory to two datasets (Table 1): the plant survey dataset and the biodiversity-manipulated experiment dataset. The plant survey dataset contains nine sites of long-term grassland experiments across the United States (see also Hallett et al. 10 , and Zhao et al. 23 ). Five of nine sites are from the Long Term Ecological Research (LTER) network (see Table 1). Plant abundances were measured either as biomass or as percent cover. In percent-cover cases, summed values can exceed 100% due to vertically overlapping canopies. All sites were sampled annually and were spatially replicated. We only used data of the plant survey dataset from unmanipulated control plots. Methods for data collection were constant over time.
The biodiversity-manipulated experimental dataset comprises two long-term grassland experiments, BigBio and BioCON, at the Cedar Creek Ecosystem Science Reserve. Both experiments directly manipulated plant species number (1, 2, 4, 8, 16 for BigBio; and 1, 4, 9, 16 for BioCON). BioCON also contains different treatment levels for nitrogen and atmospheric CO 2 , but here only data from the ambient CO 2 and ambient N treatments were used. We excluded plots with only one species. BigBio comprises 125 plots over 17 years, and BioCON comprises 59 plots over 22 years (Table 1). Theory Let x i (t) denote the biomass of species i = 1, …, S at time t = 1, …, t and let μ i = mean (x i (t)), σ i = sd(x i (t)), and v i = σ 2 i be the mean, standard deviation and variance of species i, computed through time. Let v ij = cov ðx i t ð Þ, x j t ð ÞÞ be the covariance, through time, of the dynamics of species i and j. Let x tot t ð Þ = P i x i ðtÞ, μ tot = P i μ i , v tot = P i,j v ij , and σ tot = ffiffiffiffiffiffiffi ffi v tot p . When population time series are uncorrelated, v tot = P i v i . As defined previously 10,15 , community stability is the inverse coefficient of variation of x tot t ð Þ, S com = μ tot =σ tot . Population stability is the inverse of weighted-average population variability 9 , The ratio of community stability over population stability is the Loreau-de Mazancourt asynchrony index 14 Now we suppose a hypothetical community with the same species-level variances and means as the original community but with species covariances equal to zero. Then, (1) is the value of community stability in the case of uncorrelated or independent populations and SAE is the component of Φ due to statistical averaging (here, "ip" stands for "independent populations"). The equation S com_ip = (SAE)S pop can be interpreted as a definition of SAE. We then have The compensatory effect is then the rest of Φ, i.e., Considering the classic variance ratio φ = V tot P Values CPE > 1 (respectively, <1) correspond to greater (resp., lesser) community stability than would be expected if dynamics of different taxa were independent, reflecting compensatory (resp., synchronous) dynamics. We also have where p i = σ i = P i σ i . In the Introduction and Results, we characterized SAE as relating to statistical mechanisms, but Eq. (4) shows that the strength of SAE depends on the evenness of species variances, which may be influenced by species biology. In fact, SAE = S com ip S pop is a comparison between the two values that community stability would take in the scenarios of independent populations (S com ip ) and entirely synchronous populations (S pop ; see elsewhere 14 for a proof that S pop is the value community stability would take if populations were perfectly synchronous), and so may be best characterized as a statistical effect, the strength of which depends on evenness of variances (and therefore on biology). We define SAE even to be the value SAE would take in the case of perfect evenness of species variances, i.e., if all species variances were identical (that means σ 1 = σ 2 = … = σ). We can then define the evenness effect, EV N = SAE SAE even , so that the equation SAE = EV N × SAE even separates out biological/evenness effects from purely statistical effects. SAE even is a purely statistical version of statistical averaging because it only captures the stabilizing effects of averaging independent random variables, being uninfluenced by evenness. It can straightforwardly be shown that SAE even = ffiffiffi S p : applying Eq. (4) to the scenario of equal population variances, one sees that SAE even = . This is the maximum possible value of SAE for a given species richness, S.
It is possible to explicitly quantify the effects of the evenness of variability. Using the formula log S com À Á = log SAE ð Þ+ log CPE ð Þ+ logðS pop Þ, the main observation of our study has been that regression slopes of log SAE ð Þ against log S ð Þ tend to have substantially positive slopes, whereas regression slopes of log CPE ð Þ and logðS pop Þ against log S ð Þ tend to have negative or only slightly positive slopes; and hence regression slopes of log S com À Á , which are sums of the other slopes, tend to be positive primarily because of the positive relationship between log(SAE) and log(S). But, in another decomposition, we can also write log S com We can observe that, because all our regressions of log SAE ð Þagainst log S ð Þ had slope less than 1/2 (Figs. 2e and 4e), regressions of log EV N ð Þversus log S ð Þ will have negative slope for our empirical systems. Therefore log S com À Á tends to depend on log S ð Þ with a "baseline" slope of 1/2, for purely statistical reasons (the log SAE even À Á effect), with effects of evenness (log ENV ð Þ), compensatory dynamics (log(CPE)) and population variability (log(S pop )) tending to reduce this slope. This again supports the conclusion that statistical averaging is the main reason for positive diversity-stability relationships in our data, now using a definition of statistical averaging that is purely statistical. We used SAE instead of SAE even in Results to represent the concept of statistical averaging because it is a quantification of ideas which were previously present in the literature 20 , although it can be viewed instead as a combination of statistical averaging effects and effects of evenness of species variances.
Note that Loreau and de Mazancourt 14 got synchrony as 1/S for the special case of identical σ i and zero-correlation, a value which seems to contrast with our result, ffiffiffi S p , described above. But Loreau and de Mazancourt 14 measured community-wide synchrony via a statistic We can make further transformation: Here CV pop 2 means the square of the weighted average of CV i . That is, θ measures a ratio of community-level CV 2 to population level CV 2 . But in our system, our asynchrony measures a ratio of community-level stability (1/CV) to population-level stability. These differences in notational and terminological choices explain why we got ffiffiffi S p but Loreau and de Mazancourt 14 got 1/S in this special caseour results are actually consistent with those of Loreau and de Mazancourt when notational choices are accounted for.

Further decomposition of CPE
In previous sections, we decomposed asynchrony into a statistical averaging effect (SAE) and a compensatory effect (CPE) via constructing a surrogate or hypothetical community stability value S com_ip by quantifying what community stability would be if all species were to fluctuate independently and thus species covariances equal zero. By comparing the stability of the real community, S com , to the hypothetical community stability under the assumption of species independence, S com_ip , we then computed CPE as S com /S com_ip . But compensatory dynamics among species in a community can arise from at least two distinct mechanisms: (1) differential response of species to environmental perturbations, and (2) direct or indirect interactions among species 19 . Correspondingly, we can decompose CPE into two parts: compensatory effects due to differential responses to environmental perturbations (CPE env ) and compensatory effects due to species interactions (CPE int ). We here initiate that decomposition.
To separate CPE env from CPE int , we construct another surrogate/ hypothetical community stability value, called S com sur , for which the effects on community stability of components of species covariances due to species interactions are eliminated, keeping only components due to common species responses to environmental perturbations. In the following section "Surrogate community stability from different plots", we establish surrogate community stability values for the systems of the plant survey dataset by means of time series from other plots from the same system. Time series from distinct plots may covary, but if they do, it is likely because of common environmental influences rather than species interactions. In the section "Surrogate community stability from monocultures", we establish surrogate community stability values for the systems of the biodiversitymanipulated experimental dataset by means of monocultures which were established alongside the multi-species plots. Monocultures in separate plots may covary, but if they do, it is likely again because of common environmental influences rather than species interactions. Both approaches lead to approximations of the value community stability would take if species interactions were eliminated, and therefore S com sur = CPE env × SAE × S pop = CPE env × S com ip . Thus, we calculate CPE env by The compensatory effect from species interactions is then the rest of CPE, i.e.
Both CPE env and CPE int can be either greater than or less than 1, corresponding to the fact that joint species responses to environmental perturbations (CPE env ) and species interactions (CPE int ) can be either stabilizing or destabilizing. Thus, we have decomposed community stability, S com , into four parts ( Supplementary Fig. 5): population stability, S pop ; the statistical averaging effect, SAE; compensatory effects due to joint species responses to environmental perturbations, CPE env ; and compensatory effects due to species interactions, CPE int .
In the Introduction and Results, the term "portfolio effect" was used for the stabilizing effect of biodiversity from independent fluctuations (zero correlation) of species abundances through time 20 , measured by SAE. However, other studies have adopted an alternative definition of portfolio effects, allowing for non-zero correlations between species induced by common responses to the environment, but excluding components of correlations resulting from species interactions 12,19,21 . In our framework, this alternative definition of portfolio effects could be represented by SAE × CPE env ( Supplementary  Fig. 5). We prefer to group CPE env together with CPE int rather than with SAE, because SAE corresponds to primarily statistical mechanisms, whereas CPE env involves species responses to the environment, which we regard as containing biological information. But other interpretations and classifications can certainly be reasonable, as demonstrated by earlier studies which defined portfolio effects in a way that corresponds to our product SAE × CPE env 12,19,21 . In the following sections, we decompose diversity-stability relationships into components that come from the relationship of each of the four terms of Supplementary  Fig. 5 to diversity. Surrogate community stability from different plots In this section, we explain how we construct surrogate communities that apply to observational data without monoculture data, such as our plant survey dataset. In doing so, we calculate an approximate hypothetical/surrogate community stability index, S com_sur , using populations from different mixture plots. The general idea is to construct a surrogate covariance matrix, . . .
which will be used to calculate S com_sur . Again using x i (t) to denote the biomass of species i = 1, …, S at time t = 1, …, t in a focal plot, the ith diagonal element of the surrogate covariance matrix, V ii , is the variance of x i (t). The off-diagonal element C ij equals the covariance of x i x j is a surrogate time series, with z j representing a time series of species j taken from another plot. When more than one other plot contained species j, we randomly chose one. The time series Z j t ð Þ was constructed to have the same mean and variance as x j (t), but its correlations with x j (t) reflects correlations between two non-interacting populations of species i and j from distinct plots. We then calculated S com sur = X tot ffiffiffiffiffiffiffiffiffiffi P ij C ij q , and we calculated CPE env and CPE int from Eqs. (5) and (6). This method was applied only to the plant survey dataset, where plots at a site within the plant survey dataset were considered replicates. In the biodiversity-manipulated experimental dataset, different plots of the same diversity had different artificially maintained species composition.

Surrogate community stability from monocultures
In this section, we explain how we construct surrogate communities that apply to a biodiversity experiment with monoculture data. Given a community consisting of species i = 1, …, S, recall that x i (t) denotes the biomass of species i = 1, …, S at time t = 1, …, t. Suppose monocultures, y i (t), were maintained for each species over the same time period. When more than one monoculture was maintained for a species, we randomly selected one. The hypothetical/surrogate community stability value S com sur was computed as The time series Y i t ð Þ were constructed to have the same mean and variance as the time series x i (t), but with correlations equal to those between the corresponding monocultures. CPE env and CPE int were then calculated from Eqs. (5) and (6). We repeated this process 100 times, randomly selecting from among available monocultures for each species on each repeat calculation, and taking means to get CPE env and CPE int . This method was only used for the biodiversity-manipulated experimental dataset because monocultures were not available for the plant survey dataset.
It is worth noting that our construction of the surrogate community assumes that in the absence of species interactions, species in the mixture should exhibit the same correlation as those in monocultures. While this assumption may hold if population dynamics were solely influenced by environmental stochasticity, the influence of demographic stochasticity may lead to a lower correlation in the mixture than in monocultures due to the relatively lower population size in the mixture. In other words, our surrogate community might overestimate the correlation between species and thus underestimate S com sur (i.e., the expected stability of a community without interactions). Moreover, the possible underestimation of S com sur could be more pronounced for more diverse communities (which have substantially lower population sizes in mixtures than monocultures), thus possibly creating an artificially negative correlation between species richness and CPE env ( = S com sur =S com ip ), as well as a positive correlation between species richness and CPE int ( = S com =S com sur ). So, the patterns in Supplementary Fig. 7a, b might be partially explained by such artificial effects. However, how to separate out such artificial effects from other processes was by no means obvious 30 . We note, importantly, that such effects, even if they exist, should not affect our main conclusion. Indeed, the positive correlation between species richness and SAE × CPE env (Supplementary Fig. 7d) would be even stronger if such effects existed and were accounted for.

Statistical analysis
For the plant survey dataset, the values of each of our theoretical quantities were averaged across all plots for each site and then relationships between site averages were assessed with regression. For the biodiversity-manipulated experimental dataset, theoretical quantities were calculated for individual plots because species richness was manipulated at the plot level. All theoretical quantities were log 10 transformed prior to generating plots and preforming regressions, except for the Shannon index, because the Shannon index has a log transformation already embedded in its definition. All analyses were programmed in R 4.0.5 37 .
To compute the confidence interval of CPE, we constructed bootstrapped species time series. For each plot, separately, the AAFT procedure 38 , implemented in the surrog function in the R package wsyn, was used to generate bootstrapped species time series for the plot, for which time series were rendered uncorrelated while retaining the autocorrelation and marginal-distribution properties of the original data. Such a bootstrapped dataset instantiates the null hypothesis that species were unrelated while retaining other statistical properties of the data not related to species relationships. For each plot, 1000 bootstrapped datasets were computed, giving rise to 1000 bootstrapped quantities S com_ip (i) for i = 1, …, 1000. We then computed the quantities SAE (i) = S com_ip (i) /S pop and CPE (i) = S com /(SAE (i) S pop ). Confidence intervals for CPE were computed using quantiles of the distribution CPE (i) .

Reporting summary
Further information on research design is available in the Nature Portfolio Reporting Summary linked to this article.

Code availability
Complete R code supporting the findings of this study has been archived online (https://github.com/leiku/decomp_stab).